function _instanceof(instance, ctor) {
    let left_instance_prototype = Object.getPrototypeOf(instance);
    let right_ctor = ctor;

    while (true) {
        if (left_instance_prototype === null) {
            return false;
        }
        if (left_instance_prototype === right_ctor) {
            return true;
        }
        left_instance_prototype = Object.getPrototypeOf(left_instance_prototype);
    }
}